package com.itheima02.day10;

import java.util.HashSet;
import java.util.Iterator;

/**
 * @author 刘全
 * @date 2021/7/27
 */
public class HashSetDemo {
    public static void main(String[] args) {
        HashSet<Person> hs = new HashSet<>();
        hs.add(new Person("zhangsan",23));
        hs.add(new Person("lisi",24));
        hs.add(new Person("lisi",24));
        Iterator<Person> it = hs.iterator();
        while (it.hasNext()) {
            Person p = it.next();
            System.out.println(p);
        }
        System.out.println("--------------");
        for (Person h : hs) {
            System.out.println(h);
        }
    }
}
